home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 2002 November / SGI IRIX 6.5 Applications 2002 November.iso / dist / gateway.idb / usr / WebFace / Source / 20-NetworkServices / rsvp / rstat.frm.z / rstat.frm
Encoding:
Text File  |  2002-06-12  |  2.8 KB  |  88 lines

  1. #!/usr/bin/perl5
  2. #
  3. # rstat.frm
  4. #
  5. # Copyright 1988-1996 Silicon Graphics, Inc.
  6. # All rights reserved.
  7. #
  8. # This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  9. # the contents of this file may not be disclosed to third parties, copied or
  10. # duplicated in any form, in whole or in part, without the prior written
  11. # permission of Silicon Graphics, Inc.
  12. #
  13. # RESTRICTED RIGHTS LEGEND:
  14. # Use, duplication or disclosure by the Government is subject to restrictions
  15. # as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  16. # and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  17. # successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  18. # rights reserved under the Copyright Laws of the United States.
  19. #
  20. # $Id: rstat.frm,v 1.3 1998/02/11 23:20:45 jrw Exp $
  21.  
  22. BEGIN { require "/usr/WebFace/lib/CGI.pm"; import CGI; }
  23. require "/usr/OnRamp/lib/OnRamp.pm";
  24.  
  25. $title = "Show RSVP Sessions";
  26.  
  27. $query = new CGI;
  28.  
  29. print $query->header;
  30. &title_block($title);
  31.  
  32. sub error {
  33.     &error_block($_[0]);
  34.     print $query->end_html;
  35.     system("/sbin/rm", "-f", $dummy);
  36.     exit 0;
  37.  
  38. &header_block($title);
  39.  
  40. if (! -e "/usr/etc/rstat")
  41. {
  42.     print "<i>The RSVP session tool (rstat) is available on "
  43.         . "IRIX versions 6.5 and higher.  For information "
  44.         . "about upgrading to IRIX 6.5, please contact your "
  45.         . "local Silicon Graphics sales representative.</i>\n"
  46.         . "</body></html>\n";
  47.     exit 0;
  48. }
  49.  
  50. open (RSTAT, "/usr/etc/rstat -p |") || &error("Can't get session status.");
  51. @sessions = <RSTAT>;
  52. close(RSTAT);
  53.  
  54. if ($#sessions == 0) {
  55.        &error("RSVP is not enabled.");
  56. } elsif ($#sessions == 1) {
  57.        print qq|<p><br><br><font size=4>There are currently no 
  58.                 sessions to view.</font>|;
  59. } else {
  60.  
  61.     for ($i = 0; $i <= $#sessions; $i++) {
  62.         $line = $sessions[$i];
  63.             chop($line);
  64.         if ($line =~ /^\s*$/) {
  65.             print $line;
  66.         } elsif ($line =~ /^Iface/) {
  67.             print "<center><table cellpadding=5 width=450 border=2>\n";
  68.             print "<tr><th>Interface<th>Type<th>Session", 
  69.                   "<th>Sender<th>Neighbor</tr>\n";
  70.         } elsif ($line =~ /^\s+\>\>/) {
  71.             print "<tr><td colspan=5 align=right>$line</tr>\n";
  72.         } elsif ($line =~ /^-- Path --/) {
  73.            ($tmp,$tmp,$tmp,$session,$sender,$neighbor) = split(/\s+/, $line);
  74.             print "<tr align=center><td colspan=2>-- Path --<td>$session", 
  75.                   "<td>$sender<td>$neighbor</tr>\n";
  76.         } else {
  77.            ($iface,$type,$session,$sender,$neighbor) = split(/\s+/, $line);
  78.             print "<tr align=center><td>$iface<td>$type<td>$session", 
  79.                   "<td>$sender<td>$neighbor</tr>\n";
  80.         }
  81.     }
  82.     print "</table></center><br>\n";
  83. }
  84.  
  85. print $query->end_html;
  86.  
  87.